<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
<meta charset="utf-8">
	<title>恒铸智能柜管理平台</title>
	<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
			<meta name="viewport"
				content="width=device-width, initial-scale=1, maximum-scale=1">
				<meta name="apple-mobile-web-app-status-bar-style" content="black">
					<meta name="apple-mobile-web-app-capable" content="yes">
						<meta name="format-detection" content="telephone=no">
							<link rel="stylesheet"
								href="${pageContext.request.contextPath}/resources/layui/css/layui.css"
								media="all" />
							<script type="text/javascript"
								src="${pageContext.request.contextPath}/resources/js/jquery-1.4.4.min.js"></script>
							<script type="text/javascript"
								src="${pageContext.request.contextPath}/resources/layui/layui.js"></script>
</head>
<style>
.layui-form-label {
	width: 32px !important;
}

.layui-input-block {
	margin-left: 66px !important;
}

.layui-form {
	padding: 10px 20px 0 0;
}
</style>
<body class="childrenBody">
	<form class="layui-form">
		<div class="layui-form-item">
			<label class="layui-form-label">标题</label>
			<div class="layui-input-block">
				<input type="text" name="title" placeholder="请输入内容"
					autocomplete="off" class="layui-input title">
			</div>
		</div>
		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">内容</label>
			<div class="layui-input-block">
				<textarea placeholder="请输入内容" name="content"
					class="layui-textarea content"></textarea>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" style="float: right;" type="submit">立即提交</button>
			</div>
		</div>
	</form>
	<script>
        layui.use(['form', 'layer'], function () {
            var form = layui.form,
                layer = parent.layer === undefined ? layui.layer : top.layer,
                $ = layui.jquery;

                $("form").submit(function(e){
                    var param = $("form").serialize()+"&sign=1";
                    // console.log(param)
                    var title = $(".title").val();
                    var content = $(".content").val();

                    if(title != "" && content != ""){
                        $.post("/applet/insert", param, function (res) {
                            if (res.success) {
                                layer.msg(res.message)
                                parent.window.location.reload();
                            } else {
                                layer.msg(res.message)
                            }
                        })
                    }else{
                        layer.msg("不能为空！")
                    }
                });

        })
    </script>
</body>
</html>